{extend name="base" /}
{block name="body"}
<div class="layui-body">
    <!--tab标签-->
    <div class="layui-tab layui-tab-brief">
        <ul class="layui-tab-title">
            <li class="layui-this">投票设置</li>
        </ul>
        <div class="layui-tab-content">
            <div class="layui-tab-item layui-show">
                <form class="layui-form form-container" action="{:url('admin/Vote/upd')}" method="post">
                    <div class="layui-form-item">
                        <label class="layui-form-label">报名时间</label>
                        <!--<div class="layui-input-block">-->
                            <!--<input type="text" name="signTime" value="" class="layui-input datetime">-->
                        <!--</div>-->
                        <div class="layui-input-inline">
                            <input type="text" name="signStartTime" value="{$picture['signStartTime']}" class="layui-input datetime" id="signStartTime">
                        </div>
                        <div class="layui-input-inline">
                            <input type="text" name="signEndTime" value="{$picture['signEndTime']}" class="layui-input datetime" id="signEndTime">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">投票时间</label>
                        <div class="layui-input-inline">
                            <input type="text" name="voteStartTime" value="{$picture['voteStartTime']}" class="layui-input datetime" id="LAY_demorange_s">
                        </div>
                        <div class="layui-input-inline">
                            <input type="text" name="voteEndTime" value="{$picture['voteEndTime']}" class="layui-input datetime" id="LAY_demorange_e">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label">每人每日投票次数</label>
                        <div class="layui-input-block">
                            <input name="voteNumPer" value="{$picture['voteNumPer']}" placeholder="每人每日投票次数" class="layui-input" style="width: 390px">
                        </div>
                    </div>
                    <!--<div class="layui-form-item">-->
                        <!--<label class="layui-form-label">每日分享奖励投票次数</label>-->
                        <!--<div class="layui-input-block">-->
                            <!--<input name="voteNumShare" value="{$picture['voteNumShare']}" placeholder="每日分享奖励投票次数"-->
                                   <!--class="layui-input" style="width: 390px">-->
                        <!--</div>-->
                    <!--</div>-->
                    <div class="layui-form-item">
                        <label class="layui-form-label">为自己投票</label>
                        <div class="layui-input-block">
                            <input type="radio" name="isForMyself" value="1"
                                   title="开启" <?php if($picture['isForMyself']=='1') echo " checked=\"checked\""; ?>>
                            <input type="radio" name="isForMyself" value="0"
                                   title="关闭" <?php if($picture['isForMyself']=='0') echo " checked=\"checked\""; ?>>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-input-block">
                            <input type="hidden" value="{$picture['id']}" name="id">
                            <button class="layui-btn" lay-submit lay-filter="*">更新</button>
                            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
{/block}
{block name="script"}
<script>
    layui.use('laydate', function(){
        var laydate = layui.laydate;

        var start = {
            min: laydate.now()
            ,max: '2099-06-16 23:59:59'
            ,istime: true
            ,format: 'YYYY-MM-DD hh:mm:ss'
            ,istoday: false
            ,choose: function(datas){
                end.min = datas; //开始日选好后，重置结束日的最小日期
                end.start = datas //将结束日的初始值设定为开始日
            }
        };

        var end = {
            min: laydate.now()
            ,max: '2099-06-16 23:59:59'
            ,istime: true
            ,format: 'YYYY-MM-DD hh:mm:ss'
            ,istoday: false
            ,choose: function(datas){
                start.max = datas; //结束日选好后，重置开始日的最大日期
                if(new Date(datas)<new Date($('#LAY_demorange_s').val())){
                   $("#LAY_demorange_e").val($('#LAY_demorange_s').val());
                    alert("结束时间不能小于开始时间!");
                }
                if(new Date(datas)<new Date($('#signStartTime').val())){
                    $("#signEndTime").val($('#signStartTime').val());
                    alert("结束时间不能小于开始时间!");
                }
            }
        };

        document.getElementById('LAY_demorange_s').onclick = function(){
            start.elem = this;
            laydate(start);
        };
        document.getElementById('LAY_demorange_e').onclick = function(){
            end.elem = this;
            laydate(end);
        };
        document.getElementById('signStartTime').onclick = function(){
            start.elem = this;
            laydate(start);
        };
        document.getElementById('signEndTime').onclick = function(){
            end.elem = this;
            laydate(end);
        };
    });
</script>
{/block}